﻿using Data;
using Data.DBModels;
using Data.MyDbContext;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Utilities;

namespace WebIndex1.Controllers
{
    public class WidgetsController : Controller
    {

        private WebStudioDbContext db = new WebStudioDbContext();
        //
        // GET: /Widgets/


        public ActionResult Edit(Guid id, EntityType type)
        {
            id.me_IsValidThrowExceptions();

            //switch(type)
            //{
            //    case EntityType.Website:
            //        Website website = db.Websites.Find(id);
            //        return View(website);

            //}
            Website website = db.Websites.Find(id);
            if (website == null)
            {
                return HttpNotFound();
            }
            return View(website);
        }

        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }

    }
}
